<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- 属性文件 -->
    <property name="LOG_HOME" value="logs"/>
    <property name="LOG_PREFIX" value="${sysName}-server"/>

    <!-- 默认的控制台日志输出，一般生产环境都是后台启动，这个没太大作用 -->
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
        <!--<Encoding>UTF-8</Encoding>-->
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>%date [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
        </layout>
    </appender>

    <!-- 配置文件轮转 -->
    <appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!--<Encoding>UTF-8</Encoding>-->
        <File>${r'${LOG_HOME}'}/${r'${LOG_PREFIX}'}-info.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <FileNamePattern>${r'${LOG_HOME}'}/history/${r'${LOG_PREFIX}'}-info.%d{yyyy-MM-dd}.log.gz
            </FileNamePattern>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>%date [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
        </layout>
    </appender>

    <!-- 修改其他包的日志输出级别 -->
    <logger name="${packPath}">
        <level value="info"/>
    </logger>

    <!-- root 默认日志配置 ， 注意这里的级别哈！小心生产环境用DEBUG，压爆你的磁盘！-->
    <root level="info">
        <appender-ref ref="logfile"/>
        <appender-ref ref="stdout"/>
    </root>
</configuration>
